// 弹窗
function errorHander(title, icon) {
	console.log(title, icon);
	uni.showToast({
		title: title,
		icon: icon
	})

}
// 格式化评论
function formattingComments(comments) {
	let huifuOthers = comments.filter((item, index) => {
		item.huifu = []
		return item.parentCommentId != 0
	})

	huifuOthers.forEach(item => {
		// let huifu = []
		comments.forEach(comments => {
			if (comments.commentId == item.parentCommentId) {
				// console.log('父级',comments,'子集',item);
				// huifu.push(item)
				comments.huifu.push(item)
				// console.log(huifu);
			}

		})
	})
	return comments
}

// 判断星座
function xingzuo(month, date) {
	let value = ''
	if (month == '01' && date >= 20 || month == '02' && date <= 18) {
		value = "水瓶座";
	}
	0
	if (month == '01' && date > 31) {
		value = "Huh?";
	}
	0
	if (month == '02' && date >= 19 || month == '03' && date <= 20) {
		value = "双鱼座";
	}
	0
	if (month == '02' && date > 29) {
		value = "Say what?";
	}
	0
	if (month == '03' && date >= 21 || month == '04' && date <= 19) {
		value = "白羊座";
	}
	0
	if (month == '03' && date > 31) {
		value = "OK. Whatever.";
	}
	0
	if (month == '04' && date >= 20 || month == '05' && date <= 20) {
		value = "金牛座";
	}
	0
	if (month == '04' && date > 30) {
		value = "I'm soooo sorry!";
	}
	0
	if (month == '05' && date >= 21 || month == '06' && date <= 21) {
		value = "双子座";
	}
	0
	if (month == '05' && date > 31) {
		value = "Umm ... no.";
	}
	0
	if (month == '06' && date >= 22 || month == '07' && date <= 22) {
		value = "巨蟹座";
	}
	0
	if (month == '06' && date > 30) {
		value = "Sorry.";
	}
	0
	if (month == '07' && date >= 23 || month == '08' && date <= 22) {
		value = "狮子座";
	}
	0
	if (month == '07' && date > 31) {
		value = "Excuse me?";
	}
	0
	if (month == '08' && date >= 23 || month == '09' && date <= 22) {
		value = "处女座";
	}
	0
	if (month == '08' && date > 31) {
		value = "Yeah. Right.";
	}
	0
	if (month == '09' && date >= 23 || month == '10' && date <= 22) {
		value = "天秤座";
	}
	0
	if (month == '09' && date > 30) {
		value = "Try Again.";
	}
	if (month == 10 && date >= 23 || month == 11 && date <= 21) {
		value = "天蝎座";
	}
	if (month == 10 && date > 31) {
		value = "Forget it!";
	}
	if (month == 11 && date >= 22 || month == 12 && date <= 21) {
		value = "射手座";
	}
	if (month == 11 && date > 30) {
		value = "Invalid Date";
	}
	if (month == 12 && date >= 22 || month == '01' && date <= 19) {
		value = "摩羯座";
	}
	if (month == 12 && date > 31) {
		value = "No way!";
	}
	return value
}

export default {
	errorHander,
	formattingComments,
	xingzuo

}
